package com.hjb.toolbardemo.fragment;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hjb.toolbardemo.R;
import com.hjb.toolbardemo.activity.ContainerActivity;
import com.hjb.toolbardemo.activity.MainActivity;
import com.hjb.toolbardemo.base.BaseFragment;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * 作者 : hjb
 * 时间 : 2016/4/25.
 */
public class MineTabFragment extends BaseFragment {
    @InjectView(R.id.text1)
    TextView mText1;
    @InjectView(R.id.text2)
    TextView mText2;
    @InjectView(R.id.text3)
    TextView mText3;
    @InjectView(R.id.root_Ll)
    LinearLayout mRootLl;

    @Override
    public View initRootView() {
        rootView = mInflater.inflate(R.layout.frag_mine, null);
        ButterKnife.inject(this, rootView);
        return rootView;
    }

    @Override
    public void setViews() {

    }

    @Override
    public void initData() {

    }

    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            if (msg.what == 1)
                activity.dismissProgress();
        }
    };

    @OnClick({R.id.button1, R.id.button2, R.id.button3})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.button1://切换到首页
                ((MainActivity) activity).switchFragment(0);
                break;
            case R.id.button2:
                ContainerActivity.startActivityForResurt((MainActivity) getActivity(), OneFragment.class, null, 12);
                break;
            case R.id.button3:
//                ContainerActivity.init(new FoldingEffect());
                ContainerActivity.startActivity(getActivity(),OneFragment.class,null);
//                activity.showProgress(activity, rootView,"进度条");
//                new Thread() {
//                    @Override
//                    public void run() {
//                        super.run();
//                        try {
//                            Thread.sleep(3000);
//                            handler.sendEmptyMessage(1);
//                        } catch (InterruptedException e) {
//                            e.printStackTrace();
//                        }
//                    }
//                }.start();
                break;
        }
    }


    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        String string = data.getStringExtra("string");
        Log.i("----", string);
    }
}
